package com.heima.wemedia.controller.v1;


import com.heima.model.admin.dtos.AdSensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "管理端敏感词相关接口",tags = "管理端敏感词相关接口")
@Slf4j
public class WmSensitiveController {

    @Autowired
    private WmSensitiveService wmSensitiveService;

    @PostMapping("/list")
    @ApiOperation("分页查询敏感词")
    public ResponseResult list(@RequestBody WmSensitiveDto dto){
        return wmSensitiveService.list(dto);
    }


    @DeleteMapping("/del/{id}")
    @ApiOperation("删除敏感词")
    public ResponseResult del(@PathVariable Integer id){
        return wmSensitiveService.delSensitive(id);
    }

    @PostMapping("/save")
    @ApiOperation("新增敏感词")
    public ResponseResult save(@RequestBody AdSensitiveDto adSensitiveDto){
        return wmSensitiveService.saveSensitive(adSensitiveDto);
    }

    @PostMapping("/update")
    @ApiOperation("修改敏感词")
    public ResponseResult update(@RequestBody AdSensitiveDto adSensitiveDto){
        return wmSensitiveService.upDateSensitive(adSensitiveDto);
    }

}
